#!/bin/bash
i=1
ip=172.22.128.44
mail=cfwr1991@126.com
while ((i <= 10))
do
    n=`ping -c 10 $ip | grep 'received' | awk -F'received, |%' '{print $2}'`
    echo $n
    if [ -z "$n" ]
    then
        echo "The is something wrong in the script!"
    fi
    if [ "$n" -ge 20 ]
    then
        echo "Email to DevOps"
    fi
    sleep 30
    #echo "hello"
done
